<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="java.util.List"%>
<%@ page isELIgnored="false" %> <%--isELIgnored=true禁用EL表达式--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>首页</title>
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/reset.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/css/main.css">
	<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/layui-v2.6.13/layui/css/layui.css">
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.12.4.min.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-ui.min.js"></script>
	<script type="text/javascript" src="<%=request.getContextPath() %>/js/slide.js"></script>
	<style>
		.div1{
			margin-bottom: 20px;
		}
	</style>
</head>
<body style="background-color:white">
	<div class="header_con">
		<div class="header">
			<div class="welcome fl">欢迎来到天天生鲜!</div>

			<div class="fr">

				<div class="login_btn fl">
				    欢迎您：<em>${user.uName}</em>
				    <span>|</span>
					<a href="/user/loginPage">注销</a>
					<span>|</span>
					<a href="/user/registerPage">注册</a>
				</div>
				<div class="user_link fl">
					<span>|</span>
					<a href="/user/centerPage">用户中心</a>
					<span>|</span>
					<a href="cartPage?uId=${user.id}">我的购物车</a>
					<span>|</span>
					<a href="/user/centerOrderPage">我的订单</a>
				</div>
			</div>
		</div>		
	</div>

	<div class="search_bar clearfix div1" >
		<a href="list?id=${user.id}" class="logo fl"><img style="width: 200px;height: 100px;" src="<%=request.getContextPath() %>/images/logo.png"></a>
		<div class="search_con fl">
			<input  type="text" class="input_text fl" name="" placeholder="搜索商品">
			<input  style="background-color: silver;" type="button" class="input_btn fr" name="" value="搜索">
		</div>

	</div>

	<div class="navbar_con">
		<div class="navbar">
			<h1 class="fl" style="background-color: silver;">全部商品分类</h1>
			<ul class="navlist fl">
				<li><a href="">首页</a></li>
				<li class="interval">|</li>
				<li><a href="">手机生鲜</a></li>
				<li class="interval">|</li>
				<li><a href="">抽奖</a></li>
			</ul>
		</div>
	</div>

	<div class="center_con clearfix">
		<ul class="layui-menu subnava fl" style="width: 200px;">
        <c:forEach items="${parent}" var="obj">

            <li class="layui-menu-item-divider"></li>
            <li class="layui-menu-item-parent">
                <div class="layui-menu-body-title" onclick="searchP(${obj.sortId});">
                    ${obj.sName}
                    <i class="layui-icon layui-icon-right"></i>
                </div>
                <div class="layui-panel layui-menu-body-panel">
                    <ul>
                    <c:forEach items="${sort}" var="k">
                        <c:if test="${k.parentId == obj.sortId}">
                        <li>
                            <div class="layui-menu-body-title" onclick="search(${k.sortId});">${k.sName}</div>
                        </li>
                        </c:if>
                    </c:forEach>
                    </ul>
                </div>
            </li>
        </c:forEach>
        </ul>
		<div class="slide fl">
			<ul class="slide_pics">
				<li><img src="<%=request.getContextPath() %>/images/slide.jpg" alt="幻灯片"></li>
				<li><img src="<%=request.getContextPath() %>/images/slide02.jpg" alt="幻灯片"></li>
				<li><img src="<%=request.getContextPath() %>/images/slide03.jpg" alt="幻灯片"></li>
				<li><img src="<%=request.getContextPath() %>/images/slide04.jpg" alt="幻灯片"></li>
			</ul>
			<div class="prev"></div>
			<div class="next"></div>
			<ul class="points"></ul>
		</div>
		<div class=""><!-- adv fl -->
			<a href="#"><img src=""></a>
			<a href="#"><img src=""></a>
		</div>
	</div>

	<c:forEach items="${parent}" var="parentObj">
    <%
        int i=0;
    %>
	    <div class="list_model">
	        <div class="list_title clearfix">
                <h3 class="fl" style="color:silver;">${parentObj.sName}</h3>
                <div class="subtitle fl">
                    <c:forEach items="${sort}" var="sortObj">
                        <c:if test="${sortObj.parentId == parentObj.sortId}">
                            <span>|</span>
                            <a href="listBySort?sortId=${sortObj.sortId}">${sortObj.sName}</a>
                        </c:if>
                    </c:forEach>
                </div>
                <a href="listByParent?parentId=${parentObj.sortId}" class="goods_more fr">查看更多</a>
            </div>
		<div class="goods_con clearfix">
			<div class="goods_banner fl"><img src="http://localhost:8887/${parentObj.imgUrl}"></div>
			<ul class="goods_list fl">

				<c:forEach items="${list}" var="obj">
                    <%
                        if(i<4){
                    %>
						<c:if test="${obj.parentId == parentObj.sortId}">
                            <li>
                                <h4><a href="#">${obj.gName}</a></h4>
                                <a href="detailPage?id=${obj.id}&uid=${user.id}"><img src="http://localhost:8887/${obj.imgUrl}"></a>
                                <div class="prize">¥ ${obj.gPrice}</div>
                                <% i=i+1;%>
                            </li>
                        </c:if>
                    <%
                        }
                    %>
				</c:forEach>

			</ul>
		    </div>
	    </div>
	</c:forEach>

	<div class="footer">
		<div class="foot_link">
			<a href="#">张旭光太胖</a>
			<span>|</span>
			<a href="#">张旭光太丑</a>
			<span>|</span>
			<a href="#">张旭光太虚</a>
			<span>|</span>
			<a href="#">健脑补肾丸</a>
		</div>
		<p> 北京旭光补肾技术有限公司 </p>
		<p>电话：541885418828    京ICP备*******8号</p>
	</div>

</body>
</html>
